/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package validator;

import Errors.ErrorInformation.ERRORS;
import java.io.FileNotFoundException;
import java.io.FileReader;
import readers.Reader;

/**
 *
 * @author Chris
 */
public class validTeacher extends validator {
    public validTeacher() { err = ERRORS.VALID; }
    
    public boolean isValid(String userName) {
        if(userName == null) {
            err = ERRORS.INVALID_TEACHER;
            return false;
        }
        try {
            FileReader fr = new FileReader(Reader.readLocation + userName + "_teacher.txt");
            err = ERRORS.VALID;
            return true;
        }
        catch(FileNotFoundException nf) {
            err = ERRORS.INVALID_TEACHER;
            return false;
        }
        catch(Exception ex){
            err = ERRORS.INVALID_TEACHER;
            return false;
        }
    }
}
